home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 43
/
Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso
/
-serious-
/
comms
/
other
/
ascan
/
sources
/
br.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-06-14
|
3KB
|
120 lines
/* my bumprev.rexx */
l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
l="rexxsupport.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
prg=programName("NOEXT")
if ~RMH_ReadArgs("FILE/A,VER=VERSION/K/N,REV=REVISION/K/N,NA=NOASM/S,MR=MAXREV/N") then do
call printFault(IoErr(),prg)
exit
end
if parm.1.flag then
if parm.1.value<0 then call err "bad VER value '"parm.1.value"'"
else ver=parm.1.value
else ver=-1
if parm.2.flag then
if parm.2.value<0 then call err "bad REV value '"parm.2.value"'"
else rev=parm.2.value
else rev=-1
if parm.4.flag then
if parm.4.value<10 then call err "bad MR value '"parm.4.value"'"
app=parm.0.value
hf=app"_rev.h"
if=app"_rev.i"
if ver==-1 | rev==-1 then do
if open("IN",hf,"R") then do
v=""
r=""
do while ~eof(in)
line=readln(in)
if line="" then iterate
line=translate(line," ","9"x)
parse var line "#define VERSION" d .
if d~="" then v=d
else do
parse var line "#define REVISION" d .
if d~="" then r=d
end
if v~="" & r~="" then leave
end
call close("IN")
if r~="" then
if dataType(r,"N") & r>0 then do
if rev=-1 then
if ver=-1 then rev=r+1
else rev=r
end
else call err "bad REV value '"r"' found in file '"hf"'"
if v~="" then
if dataType(v,"N") & v>0 then do
if ver=-1 then ver=v
end
else call err "bad VER value '"v"' found in file '"hf"'"
end
else do
ver=0
rev=1
end
end
if parm.4.flag then
if rev>=parm.4.value then do
ver=ver+1
rev=1
end
tab="9"x
tabtab=tab||tab
date=formatDate(,"%d %m %y")
parse var date d m y .
d=d+1-1
m=m+1-1
date = d"."m"."y
if ~open("OUT",hf,"W") then call err "can't open '"hf"' for output"
call writeln("OUT","#define PRG"tabtab||tab||'"'app'"')
call writeln("OUT","#define VERSION"tabtab||ver)
call writeln("OUT","#define REVISION"tab||rev)
call writeln("OUT","#define DATE"tabtab||'"'date'"')
call writeln("OUT","#define VERS"tabtab||'"'app ver"."rev'"')
call writeln("OUT","#define VSTRING"tabtab||'"'app ver"."rev "("date")\r\n"'"')
call writeln("OUT","#define VERSTAG"tabtab'"'"\0$VER: "app ver"."rev "("date")"'"')
call close("OUT")
if ~parm.3.flag then do
if ~open("OUT",if,"W") then call err "can't open '"hi"' for output"
call writeln("OUT","VERSION EQU" ver)
call writeln("OUT","REVISION EQU" rev)
call writeln("OUT","DATE MACRO")
call writeln("OUT",tab"dc.b" "'"date"'")
call writeln("OUT",tab"ENDM")
call writeln("OUT","VERS MACRO")
call writeln("OUT",tab"dc.b" "'"app ver"."rev"'")
call writeln("OUT",tab"ENDM")
call writeln("OUT","VSTRING MACRO")
call writeln("OUT",tab"dc.b" "'"app ver"."rev "("date")',13,10,0")
call writeln("OUT",tab"ENDM")
call writeln("OUT","VERSTAG MACRO")
call writeln("OUT",tab"dc.b" "'"app ver"."rev "("date")',0")
call writeln("OUT",tab"ENDM")
call close("OUT")
end
say "Bumped file '"app"' to" ver"."rev
exit
err: procedure expose prg
parse arg msg
say prg":" msg
exit